package com.autotest.glin.common;

import io.restassured.RestAssured;
import io.restassured.http.Headers;
import io.restassured.response.Response;
import org.testng.Reporter;

public class RunCaseJson {
    public static Response runCase(String bodyString, Headers hs) {
        Reporter.log("Get request bodyString: " + bodyString + "  Headers:" + hs);
        Response response = null;
        if (hs != null) {
            response = RestAssured.given().headers(hs).contentType("application/json;charset=UTF-8").request()
                    .body(bodyString).post();
        } else {
            response = RestAssured.given().contentType("application/json;charset=UTF-8").request().body(bodyString)
                    .post();
        }
        Reporter.log(response.asString());
        return response;
    }
}
